Skip to content

PDFCLOUD-6243: Add PDF shape overlays - #45

Draft
datalogics-kam wants to merge 11 commits into
pdfcloud-6233-new-pdfrest-api-skillfrom
pdfcloud-6243-pdf-with-added-shapes
Draft

PDFCLOUD-6243: Add PDF shape overlays#45
datalogics-kam wants to merge 11 commits into
pdfcloud-6233-new-pdfrest-api-skillfrom
pdfcloud-6243-pdf-with-added-shapes

Conversation

@datalogics-kam

Copy link
Copy Markdown
Contributor

PDFCLOUD-6243

Why this change

The Python SDK did not expose the documented /pdf-with-added-shapes operation, forcing callers to build raw requests for line and rectangle overlays. This adds a typed, validated SDK workflow that matches the service contract.

What changed (high level)

The clients now provide synchronous and asynchronous add_shapes_to_pdf helpers backed by Pydantic request models and public shape type contracts. The implementation keeps uploaded-file lifecycle handling consistent with existing helpers and serializes shape objects into the API JSON layout.

Behavior changes

Callers can add one or more lines or rectangles to an uploaded PDF, including RGB or CMYK colors, opacity, stroke width, output naming, and optional accessibility tagging. Local validation rejects invalid coordinates, conflicting color modes, non-PDF inputs, empty shape lists, and tagging metadata without tag_enabled=True.

Validation

  • uv run pytest --ignore tests/live -n auto --maxschedchunk 2 — 1,001 passed.
  • PDFREST_LIVE_BASE_URL=http://sleipnir:3000/ uv run pytest tests/live/test_live_add_shapes_to_pdf.py -n auto --maxschedchunk 2 — 4 passed.
  • Ruff, BasedPyright, and the client class-function coverage gate passed.
  • The Python 3.11 nox session passed with live tests excluded. The full matrix remains limited by the local Python 3.10 nox virtualenv symlink loop.

Risks and follow-ups

This is a stacked draft PR on #44: merge #44 first, then this PR. The PR base is pdfcloud-6233-new-pdfrest-api-skill, so reviewers see only the endpoint-support layer. No breaking changes are intended.

@datalogics-kam
datalogics-kam force-pushed the pdfcloud-6243-pdf-with-added-shapes branch from 847f705 to ed495f3 Compare August 23, 2026 00:39
@datalogics-kam
datalogics-kam force-pushed the pdfcloud-6243-pdf-with-added-shapes branch from ed495f3 to c13e6a3 Compare August 23, 2026 13:39
- Define PEP 723 metadata, layout, resource, and docstring conventions
- Document local and matrix validation for live examples

Assisted-by: Codex
- Require endpoint examples and explicit sample input discovery
- Define script structure and local validation expectations

Assisted-by: Codex
- Guide examples toward public keyword constructors and union aliases
- Preserve dictionary literals for dynamic, invalid, and wire-format data

Assisted-by: Codex
- Add sync and async shape helpers with typed line and rectangle inputs
- Validate shape coordinates, colors, tagging, and PDF resources
- Cover JSON serialization, live service behavior, and API guide discovery

Assisted-by: Codex
- Resolve MkDocs cross-references for added shape object types
- Restore strict documentation build validation

Assisted-by: Codex
- Assert async timeout propagation and PDF MIME validation
- Reject multiple input PDFs through both client transports
- Cover shape geometry, opacity, and color range boundaries

Assisted-by: Codex
- Accept one RGB or CMYK color field for each shape color
- Route colors to pdfRest's RGB or CMYK wire fields by channel count
- Update unit and live endpoint coverage

Assisted-by: Codex
- Describe line and rectangle shape fields for generated API reference
- Mark the shape union as a type alias so its union renders correctly

Assisted-by: Codex
- Prefer PDFREST_LIVE_BASE_URL before the standard endpoint candidates
- Document live-test configuration and fallback behavior for contributors

Assisted-by: Codex
- Demonstrate typed rectangle and line construction
- Exercise tagging and report output metadata against a bundled PDF

Assisted-by: Codex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant